<template>
  <div class="my">
    <header class="top">
      <div class="oilnum">{{ cardOilsTypeText[orderInfo.cardOilsType] }}</div>
      <div class="stationname">{{ orderInfo.stationName }}</div>
      <div class="paytime">{{ orderInfo.createTime }}</div>
      <div class="full">
        <span>充值金额</span>
        <span>{{ orderInfo.amt || 0 }}元</span>
      </div>
      <div class="full">
        <span>赠送金额</span>
        <span>{{ orderInfo.presentAmt || 0 }}元</span>
      </div>
    </header>
    <section class="center">
      <div class="amt">
        <span>卡余额</span>
        <span>{{ orderInfo.balance || 0 }}元 </span>
      </div>
      <div class="invoice">
        <span>
          可开票金额
          <nuxt-link
            v-if="orderInfo.payType != 'cs_pt'"
            :to="{
              path: `/${enterpriseId}/invoice`,
              query: {
                orderNo: orderInfo.orderNo,
                maxAmt: orderInfo.invoiceBalance,
                businessName: orderInfo.businessName
              }
            }"
            tag="button"
          >
            去开票
          </nuxt-link>
        </span>
        <span>{{ orderInfo.invoiceBalance || 0 }}元</span>
      </div>
    </section>
    <footer class="bottom">
      <div class="ordernum">
        <span>订单编号</span>
        <span>{{ orderInfo.orderNo }}</span>
      </div>
    </footer>
  </div>
</template>
<script>
export default {
  head() {
    return {
      title: "订单详情"
    };
  },
  data() {
    return {
      orderInfo: {},
      cardOilsTypeText: [
        "通用卡",
        "汽油卡",
        "柴油卡",
        "LNG卡",
        "CNG卡",
        "超级会员"
      ]
    };
  },
  created() {
    console.log(this.$route);
    this.getCardRecordDetailInfo();
  },
  methods: {
    async getCardRecordDetailInfo() {
      const obj = this.$route.query;
      const orderNo = obj.orderNo;
      const cardOilsType = decodeURIComponent(obj.cardOilsType);
      const res = await this.$axios.$get("/getCardRecordDetail", {
        params: {
          orderNo: orderNo,
          cardOilsType: cardOilsType
        }
      });

      this.orderInfo = res.data || {};
      console.log(3333, this.orderInfo);
    }
  }
};
</script>
<style lang="scss" scoped>
.my {
  padding: 0.4rem;
  padding-bottom: 0;
  width: 100vw;
  min-height: 100vh;
  box-sizing: border-box;
  background-color: #f8f8f8;
  .top {
    background-color: #ffffff;
    overflow: hidden;
    padding: 0.2rem 0.25rem;
    display: flex;
    flex-direction: column;
    text-align: center;
    > div {
      height: 0.45rem;
      line-height: 0.45rem;
      font-size: 0.26rem;
    }
    .oilnum {
      height: 0.8rem;
      line-height: 0.8rem;
      font-size: 0.5rem;
      font-weight: bolder;
    }
    .stationname {
    }
    .paytime {
      font-size: 0.25rem;
    }
    // .others {
    //   margin: 0 auto;
    //   margin-top: 0.5rem;
    //   width: 100%;
    //   background-color: #f8f8f8;
    //   display: flex;
    //   flex-direction: column;
    //   border-radius: 0.15rem;
    //   padding: 0.3rem 0.3rem;
    //   box-sizing: border-box;

    //   > div {
    //     height: 0.6rem;
    //     line-height: 0.6rem;
    //     display: flex;
    //     justify-content: space-between;
    //     span:nth-child(2) {
    //       color: #3c3c3c;
    //     }
    //   }
    // }
    .full {
      display: flex;
      justify-content: space-between;
      font-size: 0.26rem;
      margin-top: 0.2rem;
      margin-bottom: 0.1rem;
      color: #0c0c0c;
      //font-weight:bold;
    }
  }
  .center {
    //background-color:#f8f8f8;
    > div {
      display: flex;
      justify-content: space-between;
      height: 0.9rem;
      line-height: 0.9rem;
      border-radius: 0 0 0.15rem 0.15rem;
      box-sizing: border-box;
      padding: 0 0.2rem;
      font-size: 0.26rem;
    }
    .amt {
      background-color: #e8e8e8;
      .arrows {
        color: #737373;
        font-size: 0.26rem;
      }
    }
    .invoice {
      .icon {
        display: inline-block;
        width: 0.26rem;
        height: 0.26rem;
        border-radius: 0.13rem;
        //background-color: #377ec4;
        margin-left: 0.2rem;
        margin-bottom: -2px;
        background: url("../../../static/common/qm.svg") no-repeat 0 0;
        background-size: 100% 100%;
      }
      button {
        width: 1.3rem;
        height: 0.6rem;
        line-height: 0.6rem;
        padding: 0;
        font-size: 0.26rem;
        color: blue;
        background-color: transparent;
        outline: none;
        border: none;
        box-shadow: 0px 1px 1px 0px skyblue;
      }
    }
  }
  .bottom {
    width: 100%;
    margin-top: 0.4rem;
    font-size: 0.26rem;
    > .ordernum {
      display: flex;
      justify-content: space-between;
      line-height: 1rem;
      height: 1rem;
      border-radius: 0.15rem;
      background: #ffffff;
      box-sizing: border-box;
      padding: 0 0.2rem;
      box-shadow: 0 1px 2px 2px rgba(201, 207, 207, 0.1);
    }
  }
}
</style>
